import {
  SET_IPCAMS,
  REFRESH_IPCAMS_START,
  REFRESH_IPCAMS_END,
  SET_IPCAM_VENDORS,
  REFRESH_IPCAM_VENDORS_START,
  REFRESH_IPCAM_VENDORS_END,
} from '../mutation-types'

import _ from 'lodash'

// initial state
const state = {
  ipcam: {
    list: [],
    loading: false,
  },
  vendor: {
    list: [],
    loading: false,
  }
}

// mutations
const mutations = {
  //ipcams
  [SET_IPCAMS] (state, val) {
    state.ipcam.list = val
  },
  [REFRESH_IPCAMS_START] (state) {
    state.ipcam.loading = true
  },
  [REFRESH_IPCAMS_END] (state) {
    state.ipcam.loading = false
  },
  //ipcam vendors
  [SET_IPCAM_VENDORS] (state, val) {
    state.vendor.list = val
  },
  [REFRESH_IPCAM_VENDORS_START] (state) {
    state.vendor.loading = true
  },
  [REFRESH_IPCAM_VENDORS_END] (state) {
    state.vendor.loading = false
  },
}

export default {
  state,
  mutations
}